package demo;

import com.training.action.Action;
import com.training.form.ActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by Ywen on 2018/12/2.
 */
public class DemoAction implements Action {
    @Override
    public String execute(ActionForm form, Map<String, String> actionForwardMap, HttpServletRequest request, HttpServletResponse response) {
        DemoFrom demoFrom = (DemoFrom) form;
        String name = demoFrom.getName();
        String password = demoFrom.getPassword();
        System.out.println(name + "=" + password);
        if (name.equals("ywen")) {
            return actionForwardMap.get("success");
        }
        return actionForwardMap.get("fail");
    }

}
